/*
 * movie.cpp
 *
 *  Created on: Feb 22, 2016
 *      Author: ezhaome
 */
#include "movie.h"

Movie::Movie()
{
	_title = "None";
	_price = NULL;
}

Movie::Movie(string title, int priceCode)
{
	_title = title;
	setPriceCode(priceCode);
}


void Movie::setPriceCode(int priceCode)
{
	/*
	if (_price != NULL)
	{
		delete _price;
	}
	*/
	switch(priceCode)
	{
	case REGULAR:
		_price = new RegularPrice();
		break;
	case CHILDREN:
		_price = new ChildrenPrice();
		break;
	case NEW_RELEASE:
		_price = new NewReleasePrice();
		break;
	default:
		break;
	}
}

int Movie::getPriceCode()
{
	return _price->getPriceCode();
}

string Movie::getTitle()
{
	return _title;
}

double Movie::getCharge(int daysRented)
{
	return _price->getCharge(daysRented);
}


int Movie::getFrequentPoints(int daysRented)
{
	return _price->getFrequentPoints(daysRented);
}
